package com.cugbmao.lucene;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class WebCrawler
{
	 private static String text_file_path = "/Users/mac/Lucene/htmlsrc.html";
	public static void main(final String[] args)
	{
		try
		{
			File file = new File(text_file_path);
			FileWriter fpWriter = new FileWriter(file);
			
			//生成下载对象
			Socket webclient = new Socket("www.bnu.edu.cn", 80);
			PrintWriter result = new PrintWriter(webclient.getOutputStream(), true);
			BufferedReader receiver = new BufferedReader(new InputStreamReader(webclient.getInputStream()));
			
			//发送HTTP request请求
			result.println("GET / HTTP/1.1");
			result.println("Host: bnu.edu.cn");
			result.println("Connection: Close");
			result.println();
			
			//接收HTTP Response 返回的结果信息
			
		}
		catch (Exception e)
		{
			// TODO: handle exception
		}
	}

}
